<extend name="Public/frame" />
<block name="content-box">

    <table class="table table-striped">
        <thead>
            <tr>
                <th>{$Think.lang.name}</th>
                <if condition="is_founder()">
                    <th>{$Think.lang.operation}</th>
                </if>
            </tr>
        </thead>
        <tbody>
            <foreach name="mods" item="v">
                <tr>
                    <td>{$v.name}</td>
                    <if condition="is_founder()">
                        <td>
                            <a href="#" title="{$Think.lang.build}" class="admin_mod_build_btn" data-mod="{$v.name}"><span class="glyphicon glyphicon-refresh"></span></a>
                        </td>
                    </if>
                </tr>
            </foreach>
        </tbody>
    </table>

    <script type="text/javascript">
        require(['jquery'],function() {
            $(function () {
                $('.admin_mod_build_btn').on('click', function (e) {
                    admin_mod_build($(this).attr('data-mod'));
                    return false;
                });
                function admin_mod_build(mod) {
                    var url = "{:U('Mod-controller-/build')}";
                    url = url.replace('-controller-', mod);
                    $.post(url, {}, function(data){
                        $.defaultFormCallback(data);
                    });
                }
            });
        });
    </script>

</block>